<template>
    <div
        class="modifyBillingdata"
        v-loading="pageLoading"
        element-loading-background="rgba(255, 255, 255, 0.7)"
    >
        <el-card class="box-card">
            <div slot="headerss" class="clearfix text_fl">
                <span>修改账单日</span>
                <el-button class="btn_close" type="text" @click="handleClose">关闭</el-button>
            </div>
            <div>
                <div>
                    <div v-show="isshowCardSuccessInfo">
                        <el-form
                            ref="formData"
                            :model="formData"
                            :rules="rules"
                            label-width="150px"
                            style="margin-top:10px;"
                        >
                            <el-row>
                                <el-col :span="10" :offset="1">
                                    <div class="text_center width30">
                                        <el-form-item label="账户类型:" class="text_fl">
                                            <span
                                                class="el-form-item-span"
                                            >{{formData.CATEGORY_filter}}</span>
                                        </el-form-item>
                                    </div>
                                </el-col>
                                <el-col :span="12">
                                    <div class="text_center width30">
                                        <el-form-item label="主卡卡号:" class="text_fl">
                                            <span class="el-form-item-span">{{formData.CARDNO}}</span>
                                        </el-form-item>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="10" :offset="1">
                                    <div class="text_center width30">
                                        <el-form-item
                                            label="上次帐单日修改日期:"
                                            class="text_fl"
                                            prop="EMBNAME"
                                        >
                                            <span
                                                class="el-form-item-span"
                                            >{{formData.CHGDY | filterDateYYYYMMDD}}</span>
                                        </el-form-item>
                                    </div>
                                </el-col>
                                <el-col :span="12">
                                    <div class="text_center width30">
                                        <el-form-item label="原账单日期:" class="text_fl">
                                            <span class="el-form-item-span">{{formData.CYNBR }}日</span>
                                        </el-form-item>
                                    </div>
                                </el-col>
                            </el-row>
                            <el-row>
                                <el-col :span="10" :offset="1">
                                    <div class="text_center width30">
                                        <el-form-item
                                            label="新账单日期:"
                                            class="text_fl"
                                            prop="CYCLENBRSVal"
                                        >
                                            <!-- <span class="el-form-item-span">{{formData.CYCLENBRS }}</span> -->
                                            <el-select
                                                v-model="formData.CYCLENBRSVal"
                                                placeholder="请选择新账单日期"
                                                clearable
                                            >
                                                <el-option
                                                    v-for="item in formData.CYCLENBRS_option"
                                                    :label="item.label"
                                                    :value="item.code"
                                                    :key="item.code"
                                                ></el-option>
                                            </el-select>
                                        </el-form-item>
                                    </div>
                                </el-col>
                            </el-row>
                            <!-- 话术 -->
                            <div class="hstable_wrap" v-if="speechList.length!=0">
                                <el-table
                                    :data="speechList"
                                    border
                                    stripe
                                    header-row-class-name="headerRow"
                                    ref="showListTable"
                                    class="heard-bg business_table hstable"
                                    @selection-change="handleSelectionChange"
                                >
                                    <el-table-column type="selection" label=" " min-width="55"></el-table-column>
                                    <el-table-column label="业务话术">
                                        <template slot-scope="scope">{{scope.row.content}}</template>
                                    </el-table-column>
                                </el-table>
                            </div>

                            <div class="text_center">
                                <el-button type="primary" size="small" @click="handerBillingDay">调整</el-button>
                                <!-- <el-button
                                    type="primary"
                                    size="small"
                                    plain
                                    @click="handleClose"
                                >已出账单</el-button>
                                <el-button
                                    type="primary"
                                    size="small"
                                    plain
                                    @click="handleClose"
                                    icon="el-icon-search"
                                >分期申请记录查询</el-button>
                                <el-button
                                    type="primary"
                                    size="small"
                                    plain
                                    @click="handleClose"
                                >账单修改方式</el-button>-->
                            </div>
                        </el-form>
                        <el-dialog
                            v-drag
                            title="修改账单日"
                            :visible.sync="centerDialogVisible"
                            width="500px"
                            :append-to-body="true"
                            top="30vh"
                            :close-on-click-modal="false"
                            center
                        >
                            <p>
                                卡号：
                                <span>{{this.formData.CARDNO}}</span>
                            </p>
                            <p>
                                账户类型:
                                <span>{{this.formData.CATEGORY_filter}}</span>
                            </p>
                            <p>
                                预计下次账单日:
                                <span>{{this.nextCYNBR}}</span>
                            </p>
                            <p class="text_center padding_top15">
                                <span style="color:#3a8ee6; ">您确认要修改账单日？</span>
                            </p>
                            <span slot="footer" class="dialog-footer">
                                <el-button
                                    size="small"
                                    icon="el-icon-circle-close"
                                    @click="centerDialogVisible = false"
                                >取 消</el-button>
                                <el-button
                                    type="primary"
                                    size="small"
                                    @click="setsubmitForm"
                                    icon="el-icon-circle-check"
                                    v-preventReClick
                                >确定</el-button>
                            </span>
                        </el-dialog>
                    </div>
                    <div v-if="!isshowCardSuccessInfo">
                        <ModifyVillingDateItem :CardSuccessInfo="CardSuccessInfo" pageTitle="修改账单日"></ModifyVillingDateItem>
                    </div>
                </div>
            </div>
        </el-card>
    </div>
</template>
<script>
import { mapGetters } from 'vuex';
import moment from 'moment';
import ModifyVillingDateItem from './components/ModifyVillingDateItem'
import {
    closePage,
    getDictSelectList,
    itoStr,
    getDictMappingValue, trimString,
} from '@/utils/Common';
import { isEmptyObject } from '@/utils/Object'
export default {
    name: 'ModifyVillingDate',
    data() {
        return {
            formData: {
                CYNBR: '',// 账单日
                CHGDY: '',// 上次帐单日修改日期
                CYCLENBRSVal: '',//有效账单日
                CYCLENBRS_option: '',//有效账单日
                CYCLENBRS_option_value: '',
                CATEGORY_filter: '',

            },
            nextCYNBR: '',//下次账单日
            isShowdialog: false,//不可以进入修改账单日页面 提示页
            centerDialogVisible: false,
            pageLoading: false,
            // isBillingDay: false,//是否可以进入修改账单日页面
            bilDayQuery_3018: '',//有效账单日查询接口 返回数据
            PRODUCT_value: '',//卡产品 文字
            cardserver_3014: '',//信用卡服务方式综合查询
            // Villing_4060: '',
            markedWords: '',//提示语
            CardSuccessInfo: {},
            DUEDATE_value: '',//换款截止日期
            rules: {
                CYCLENBRSVal: [{ required: true, message: '调整的新账单日期不能为空', trigger: 'blur' }],
            },
            prodlist: [],
            speechList: [],//话术列表
            selectedList: [],
            MenuId: '',

            result3077: {},
            result3077list: [],

            NEXTDAY_3077: moment(new Date(new Date().getTime() - (1000 * 60 * 60 * 24 * 365))).format('YYYYMMDD'),//翻页交易日期
            NEXTMPNO_3077: '',//翻页分期付款序号
            RtnindFlag: '',//翻页标志
            startDate: '20000101', // 开始日期
            endDate: moment(new Date()).format('YYYYMMDD'), // 结束日期 默认为当前日期
        }
    },
    components: { ModifyVillingDateItem },
    computed: {
        ...mapGetters([
            'cardInfo_3004',
            'cardAccountInfo_3001',
            'CardBill_3005',
            'defaultParams',
            'pinFlag',
            'InstallmentInfo_3077',
            'isCurrentMenuInfo',
            'AccountionTYPE_INFO'
        ]),

        isshowCardSuccessInfo() {
            if (isEmptyObject(this.CardSuccessInfo)) {
                return true
            } else {
                return false
            }
        },
    },
    filters: {
        filterDateYYYYMMDD: (value) => {
            value = (`${value}`).trim();
            if (value === '00000000') return '';
            if (value) {
                return moment(value, 'YYYYMMDD').format('YYYY-MM-DD');
            }
            return '';
        },
        // filterCYCLENBRS_option: (value) => {
        //     let optionVal = '';
        //     value.forEach((item) => {
        //         optionVal = optionVal + item + '日 '
        //     })
        //     return optionVal
        // }

    },
    async mounted() {
        this.MenuId = this.$route.params.id || '';
        this.pageLoading = true;
        this.formData.CARDNO = this.cardInfo_3004.CARDNO || this.cardInfo_3004.CARDNBR;
        this.formData.pinFlag = this.pinFlag; // 0-不检查密码 1-检查卡片级查询密码 2-检查取款密码 3-检查客户级查询密码
        this.formData.KEYTYPE = this.cardInfo_3004.KEYTYPE;// 证件类型
        this.formData.CUSTID = this.cardInfo_3004.CUSTID;// 证件类型
        this.prodlist = await getDictSelectList('PRODUCT', this);
        await this.getDictInfovalue();
        await this.setCardServerQuery();//3014



        await this.getInit();
        //这里开始判断是否可以进行账单日修改 
        this.judgeViwe();
    },
    methods: {
        // 初始化页面数据
        async getInit() {
            // this.formData.CATEGORY = this.cardInfo_3004.CATEGORY
            // 卡产品


            await this.getCardValidBillDayQuery();
            this.pageLoading = false;
            await this.getspeechList();
            await this.get3077('1');
            await this.get3077('2');
        },
        async get3077(opercode) {

            const appBody = {
                CARDNBR: this.formData.CARDNO, // 卡号
                MPTYPE: '',
                OPERCODE: opercode,
                OPT: '1',
                PINFLAG: '0', //验密标识
                PIN: '',// 密码
                BEGDAY: this.startDate, // 起始日期
                ENDDAY: this.endDate, // 结束日期 
                RTNIND: this.RtnindFlag,// 翻页标志 首次传空， 翻页传1
                NEXTDAY: this.NEXTDAY_3077,// 首次查询时送查询起始日期， 下翻页查询时上送上次查询结果的最后一条记录返回的分期付款交易日期
                NEXTMPNO: this.NEXTMPNO_3077,// 首次查询时送起始序号，默认为0 下翻页查询时上送上次查询结果的最后一条记录返回的交易序号
            };

            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3077';
            defaultParams.body.appBody = appBody;
            // 3077交易
            //console.log("this.appBody3077***********", appBody);
            await this.$post.common.transPort(defaultParams).then(async (res) => {
                if (res.status === 200) {
                    const result = JSON.parse(res.data.jsonRes);
                    console.log("***************************", result);

                    if (result.sysHead.rspCd === '000000') {
                        if (opercode === '1') {
                            this.result3077 = result.body.appBody.dataList;
                        } else {
                            this.result3077list = result.body.appBody.dataList;
                        }
                    }
                }
            });
        },
        // 请求数据字典里的字段
        async getDictInfovalue() {
            this.formData.CATEGORY_filter = await getDictMappingValue('CATE', this.cardInfo_3004.CATEGORY, this);
            console.log("this.formData.CATEGORY_filter", this.formData.CATEGORY_filter);
            this.isREPLACEFEEOption = await getDictSelectList('REPFEE', this);

            this.formData.CYCLENBRS_option = await getDictSelectList('CYCLENBRS', this);
            console.log("this.CYCLENBRS_option", this.formData.CYCLENBRS_option);
            // this.isCOURIERFEEOption = await getDictSelectList('COURFEE', this);
            // 卡产品
            console.log("this.this.prodlist", this.prodlist);
            console.log("|" + this.cardInfo_3004.PRODUCT + "|");
            this.prodlist.some(item => {
                if (item.code === itoStr(this.cardInfo_3004.PRODUCT, 4)) {
                    this.PRODUCT_value = item.label;
                    return true;
                }
            });
            //this.PRODUCT_value = await getDictMappingValue('PRODUCT', this.cardInfo_3004.PRODUCT, this);
            // this.CATEGORY_filter = await getDictMappingValue('CATE', this.cardInfo_3004.CATEGORY, this);
        },
        //根据菜单id查询话术列表
        async getspeechList() {
            console.log("this.isCurrentMenuInfo.id", this.isCurrentMenuInfo.id);
            console.log("this.MenuId", this.MenuId);
            var checkParam = {
                'id': this.MenuId || this.isCurrentMenuInfo.id,
            };
            this.$post.busiMenu.getlistByMenuId(checkParam).then((res) => {
                console.log("话术查询结果：", res);
                if (res.status === 200) { // http通讯成功
                    if (res.data.status == 0) { // 业务请求成功
                        this.speechList = res.data.content;
                    }
                }
            });
        },
        handleSelectionChange(val) {
            this.selectedList = val;
        },
        // new_cycl: 新账单日, 
        // last_day:最后还款日的天数,
        // last_month:最后还款日的月份
        // last_yeat:最后还款日的年份
        countFun(new_cycl, last_day, last_month, last_yeat) {
            if ((new_cycl * 1) > (last_day * 1)) {
                this.nextCYNBR = last_yeat + itoStr(last_month, 2) + itoStr(new_cycl, 2);
            } else {
                // 判断月份是否大于12
                if ((last_month * 1 + 1) > 12) {
                    last_month = 1;
                    last_yeat = last_yeat * 1 + 1;
                } else {
                    last_month = last_month * 1 + 1;
                }
                this.nextCYNBR = last_yeat + itoStr(last_month, 2) + itoStr(new_cycl, 2);
            }
        },
        // 计算下次账单 出账日期 
        setnextCYNBRFun() {
            const CYCLENBRSVal = this.formData.CYCLENBRSVal;//新账单日
            const CYNBR = this.formData.CYNBR;//账单日
            if (!isEmptyObject(this.CardBill_3005) && (this.CardBill_3005.DUEDATE + "").trim() !== '') {
                let DUEDATE = this.CardBill_3005.DUEDATE; //最后还款日
                console.log('3005', this.CardBill_3005);
                console.log('最后还款日', DUEDATE, '账单日', CYNBR, '新账单日', CYCLENBRSVal);
                // DUEDATE = moment(DUEDATE, 'YYYYMMDD').add(4, 'days').format('YYYYMMDD');
                // console.log('加4天后的日期格式', DUEDATE);
                let DUEday = DUEDATE.substr(6, 2);//最后还款日的天数
                let DUEMonth = DUEDATE.substr(4, 2)//最后还款日的月份
                let DUEYear = DUEDATE.substr(0, 4)//最后还款日的年份
                // 先判断新的账单日是否大于最后还款日
                // 
                // new_cycl: 新账单日, 
                // last_day:最后还款日的天数,
                // last_month:最后还款日的月份
                // last_yeat:最后还款日的年份
                this.countFun(CYCLENBRSVal, DUEday, DUEMonth, DUEYear);
                // if ((CYCLENBRSVal * 1) > (DUEday * 1)) {
                //     this.nextCYNBR = DUEYear + itoStr(DUEMonth, 2) + itoStr(CYCLENBRSVal, 2);
                // } else {
                //     // 判断月份是否大于12
                //     if ((DUEMonth * 1 + 1) > 12) {
                //         DUEMonth = 1;
                //         DUEYear = DUEYear * 1 + 1;
                //     } else {
                //         DUEMonth = DUEMonth * 1 + 1;
                //     }
                //     this.nextCYNBR = DUEYear + itoStr(DUEMonth, 2) + itoStr(CYCLENBRSVal, 2);
                // }
            } else {
                // 先获取 原账单日 和当前日期
                // 在 假设 一个假的原账单日 
                //根据 假的原账单日 计算出一个假的最后还款日  
                // 在根据假的最后还款日和当前时间 算出一个调整账单后 的新账单的出账日期
                const currentTimeY = moment().format('YYYY');//月份
                const currentTimeM = moment().format('MM');//月份
                const currentTimeD = moment().format('DD');//天日
                console.log(`110——当前时间:${CYNBR},年份：${currentTimeY},月份:${currentTimeM}，天日：${currentTimeD}`);
                let lastTimeY = 0, lastTimeM = 0, lastTimeD = 0;
                // 当月账单已出 
                console.log('输出判断——————', currentTimeD, '账单日', CYNBR);
                if (currentTimeD * 1 > CYNBR) {
                    lastTimeY = currentTimeY * 1;
                    lastTimeM = currentTimeM * 1;
                } else {
                    // 本月 未出 账单
                    if (currentTimeM > 1) {
                        lastTimeY = currentTimeY * 1;
                        lastTimeM = currentTimeM * 1 - 1;
                    } else {
                        lastTimeM = 12;
                        lastTimeY = currentTimeY * 1 - 1;
                    }
                }
                lastTimeD = CYNBR * 1
                console.log('上一次的账单日期为' + lastTimeY + lastTimeM + lastTimeD);
                //根据 假的原账单日 计算出一个假的最后还款日  
                let finalY = 0, finalM = 0, finalD = 0;
                finalD = lastTimeD + 29;
                // 30天的月份 小于等于7的月份除2余0 大于7的月份 除2 余1
                if ((lastTimeM <= 7 && lastTimeM % 2 === 0) || (lastTimeM > 7 && lastTimeM % 2 === 1)) {
                    console.log('我是30天的月份', lastTimeM);
                    if (finalD > 30) {
                        finalY = lastTimeY;
                        finalM = lastTimeM + 1;
                        finalD = finalD - 30;
                    } else {
                        finalY = lastTimeY;
                        finalM = lastTimeM;
                    }
                } else if (lastTimeM === 12) {
                    console.log('我是31天的月份', lastTimeM);
                    if (finalD > 31) {
                        finalY = lastTimeY + 1
                        finalM = 1;
                        finalD = finalD - 31;
                    } else {
                        finalY = lastTimeY;
                        finalM = lastTimeM;
                    }
                } else {
                    console.log('我是31天的月份2', lastTimeM);
                    if (finalD > 31) {
                        finalY = lastTimeY;
                        finalM = lastTimeM + 1;
                        finalD = finalD - 31;
                    } else {
                        finalY = lastTimeY;
                        finalM = lastTimeM;
                    }

                }
                console.log(`110_最后还款日1:${CYNBR},年份：${finalY}月份:${finalM}，天日：${finalD}`);
                this.countFun(CYCLENBRSVal, finalD, finalM, finalY);
            }

            // 是的话当月 会再出一个本月账单
            // 否则往后推一个月 出账
        },
        // 有效日期 转格式
        formattingCYCLENBRS(value) {
            value = (`${value}`).trim();
            let val = [];
            if (value === '') return ''
            value.split('').forEach((item, index) => {
                if (item === '1') {
                    index = index + 1
                    // index <= 9 ? index = '0' + index : index = '' + index
                    val.push(index)
                }
            })
            return val
        },
        // 是否可以进行账单日修改
        judgeViwe() {
            const newDay = moment().format('DD');
            const CYNBR_value = itoStr((this.formData.CYNBR + '').trim(), 2);
            const CARDSTAT_value = (this.cardInfo_3004.CARDSTAT + '').trim();
            const PRODUCTValue = (this.cardInfo_3004.PRODUCT + '').trim();
            // console.log('PRODUCTValue', PRODUCTValue);
            console.log('PRODUCT_value', this.PRODUCT_value);

            //AccountionTYPE_INFO 多账户 用户禁止修改账单日
            if (this.AccountionTYPE_INFO.length >= 2) {
                this.$alert(
                    '该客户为多账户，需要有账户销户后才能办理账单日修改!',
                    '修改账单日',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    // closePage(this.$route, this, 1);
                });
            }

            if (this.cardInfo_3004.MAFLAG !== '1') {
                this.$alert(
                    '当前卡必须为主卡',
                    '修改账单日',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            };

            // console.log('1111111100000', moment('20200602', 'YYYYMMDD').format('YYYY'));
            if (this.cardserver_3014.body.appBody.CHGDY !== '00000000') {
                let CHGDY_3014 = moment(this.cardserver_3014.body.appBody.CHGDY, 'YYYYMMDD').format('YYYY');
                let CurrentYear = moment(new Date()).format('YYYY');
                // 判断当前年份和3014年份是否相同
                if (CHGDY_3014 * 1 == CurrentYear * 1) {
                    this.markedWords = '本年度（自然年）已修改过账单日期 上次修改日期为 ' + this.cardserver_3014.body.appBody.CHGDY;
                    this.$alert(
                        this.markedWords,
                        '修改账单日',
                        { customClass: 'warning', type: 'warning', showClose: false },
                    ).then(() => {
                        closePage(this.$route, this, 1);
                    });
                }
            };
            if (!this.cardAccountInfo_3001.STMTDTE.trim()) {
                this.markedWords = '未到首次账单日，不可做修改操作!';
                this.$alert(
                    this.markedWords,
                    '修改账单日',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            };
            console.log(newDay, 'newDay');
            console.log('CYNBR_value', CYNBR_value);
            if (CYNBR_value === newDay) {
                this.markedWords = '原账单日当日禁止做修改操作!';
                this.$alert(
                    this.markedWords,
                    '修改账单日',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            };
            if (CARDSTAT_value !== '') {
                this.markedWords = '卡片状态异常';
                this.$alert(
                    this.markedWords,
                    '修改账单日提示',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            };
            // 94 消费分期卡  39 个人商务卡
            const PRODUCT_value = this.PRODUCT_value;
            if (PRODUCTValue === '94' || PRODUCTValue === "39") {
                // 当前卡片产品为 分期卡，个人商务卡，禁止挂失
                this.$alert(
                    `当前卡片产品为${PRODUCT_value},禁止做修改操作`,
                    '修改账单日提示',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            }
            console.log("分摊中分期交易记录：", this.result3077);

            // 正在分摊中
            if (this.result3077.length > 0) {
                this.markedWords = '存在正在分摊中的分期付款，不可进行账单日的修改！';
                this.$alert(
                    this.markedWords,
                    '修改账单日提示',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            };
            console.log("新增分期交易记录：", this.result3077list);
            // 新增的 
            if (this.result3077list.length > 0) {
                this.markedWords = '存在正在新增的分期付款，不可进行账单日的修改！';
                this.$alert(
                    this.markedWords,
                    '修改账单日提示',
                    { customClass: 'warning', type: 'warning', showClose: false },
                ).then(() => {
                    closePage(this.$route, this, 1);
                });
            }


        },
        //开始调整账单日 点击按钮验证表单信息
        handerBillingDay() {
            console.log('this.formData.CYCLENBRSVal', this.formData.CYCLENBRSVal);
            this.$refs.formData.validate((valid) => {
                if (valid) {
                    this.setnextCYNBRFun();
                    if ((this.formData.CYNBR + '').trim() === this.formData.CYCLENBRSVal) {
                        this.$alert('修改的新账单日与原账单日相同', '修改账单日提示', {
                            customClass: 'warning', type: 'warning',
                        });
                        return;
                    } else {
                        if (this.selectedList.length != this.speechList.length) {
                            this.$alert('话术尚未全部勾选！', '提示', {
                                customClass: 'warning', type: 'warning',
                            });
                            return;
                        }
                        this.centerDialogVisible = true;// 关闭弹框
                    }
                }
            });
        },

        // 要先获取账号类型  如果切换了账户类型 修改的是当前账户的 账单日的
        async setCardServerQuery() {
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3014';// 修改交易号
            defaultParams.body.appBody.CARDNBR = this.formData.CARDNO;//卡号
            defaultParams.body.appBody.PINFLAG = this.pinFlag// 验密
            //
            await this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const cardserver = JSON.parse(res.data.jsonRes);
                    if (cardserver.sysHead.rspCd == '000000') { // 交易成功
                        console.log(cardserver, 'cardserver_3014');
                        this.cardserver_3014 = cardserver;
                        // 账单日
                        this.formData.CYNBR = cardserver.body.appBody.CYNBR;
                        // 上次帐单日修改日期
                        this.formData.CHGDY = cardserver.body.appBody.CHGDY;

                        // this.ReissueCardSuccess.CATEGORY_filter = this.CATEGORY_filter;
                        // this.ReissueCardSuccess.CARDNO = this.formData.CARDNO;
                    } else {
                        const ErrorMessage = `错误码：${cardserver.sysHead.rspCd} ` + `错误信息：${cardserver.sysHead.rspMsg}`;
                        this.$alert(ErrorMessage, cardserver.sysHead.busiName, { customClass: 'error', type: 'error' });
                    }
                }
            });
        },
        //获取账单日查询  5 15 25 日
        getCardValidBillDayQuery() {
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '3018';// 修改交易号
            defaultParams.body.appBody = {
                CARDNBR: this.formData.CARDNO,//卡号
                HECKFLG: '00000000',// 检查项
                INFLAG: this.pinFlag,// 验密
            };//
            this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const cardBilling = JSON.parse(res.data.jsonRes);
                    if (cardBilling.sysHead.rspCd == '000000') { // 交易成功
                        console.log(cardBilling, 'cardBilling_3018');
                        this.bilDayQuery_3018 = cardBilling;
                        // 有效账单日期
                        this.formData.CYCLENBRS = cardBilling.body.appBody.CYCLENBRS;
                        // this.formData.CYCLENBRS_option = this.formattingCYCLENBRS(cardBilling.body.appBody.CYCLENBRS);
                        // this.ReissueCardSuccess.CATEGORY_filter = this.CATEGORY_filter;
                        // this.ReissueCardSuccess.CARDNO = this.formData.CARDNO;
                    } else {
                        const ErrorMessage = `错误码：${cardBilling.sysHead.rspCd} ` + `错误信息：${cardBilling.sysHead.rspMsg}`;
                        this.$alert(ErrorMessage, cardBilling.sysHead.busiName, { customClass: 'error', type: 'error' });
                    }
                }
            });
        },
        // // 发送请求 开始修改账单日 4060 修改客户名下所有账户的账单日 换 4002调整账单日
        setsubmitForm() {
            let params = {
                CARDNO: this.formData.CARDNO,//卡号
                CARDNBR: this.formData.CARDNO,//卡号
                PINFLAG: this.pinFlag,// 验密
                STMTDAY: this.formData.CYCLENBRSVal,//账单日期 两位日期
                KEYTYPE: this.formData.KEYTYPE,// 证件类型
                CUSTID: this.formData.CUSTID,//证件号码
                CTYPE: '01',// 修改类型
            }
            const defaultParams = JSON.parse(JSON.stringify(this.defaultParams));
            defaultParams.body.appHead.tranCode = '4002';// 修改交易号
            defaultParams.body.appBody = params

            this.$post.common.transPort(defaultParams).then((res) => {
                if (res.status === 200) { // 请求成功
                    const Villing = JSON.parse(res.data.jsonRes);
                    if (Villing.sysHead.rspCd == '000000') { // 交易成功
                        console.log(Villing, 'Villing_4060');
                        // this.Villing_4060 = Villing;
                        this.CardSuccessInfo = Villing;
                        this.CardSuccessInfo.CATEGORY_filter = this.formData.CATEGORY_filter;
                        this.CardSuccessInfo.nextCYNBR = this.nextCYNBR;
                    } else {
                        const ErrorMessage = `错误码：${Villing.sysHead.rspCd} ` + `错误信息：${Villing.sysHead.rspMsg}`;
                        this.$alert(ErrorMessage, Villing.sysHead.busiName, { customClass: 'error', type: 'error' });
                    }
                    this.centerDialogVisible = false;
                }
            });
        },

        // 点击关闭
        handleClose() {
            closePage(this.$route, this, 1);
        },
    }
}
</script>
<style lang="scss">
.modifyBillingdata {
    .el-card__header {
        padding: 8px !important;
    }
    .el-form-item__content {
        text-align: left;
    }
    .el-card {
        border-bottom: none;
    }
}
</style>
<style lang="scss" scope>
</style>